Supplemental file s2
In this Rmarkdown we provide the following workflow:
Objective 1. To investigate the types of pesticides and pesticide classes, both in terms of chemical structure and target organism, that have been used in studies examining the effects of pesticide exposure on non-larval zebrafish behaviour.
Objective 2. To investigate the study designs employed to assess the effects of pesticide exposure on the behaviour of non-larval zebrafish.
Objective 3. To identify the specific behaviours that have been investigated in pesticide exposure studies that use non-larval zebrafish as a model.
Objective 4. To assess the research outputs of different countries and investigate the level of collaboration between authors amongst different countries.
Load packages and data
Load packages
rm(list = ls())
knitr::opts_chunk$set(echo = TRUE)
pacman::p_load(tidyverse,
here,
stringr,
knitr,
formatR,
forcats,
ggplot2,
hrbrthemes, # for ggplot2
patchwork, # for ggplot2
bibliometrix,
igraph,
tidyr,
circlize,
cowplot,
mapproj)Load data
All extracted data is stored in five separate .csv files representing different aspects of the data (extracted via structured predefined Google Forms - one per table).
Bibliographic data records are exported from Scopus (including cited references field) in .bib format and locally saved as scopus.bib.
# Load data set containing background information on each study
bib <- read_csv(here("data", "zf_sm_bibliometrics.csv"), skip = 0) # 83 rows 9 columns ## Rows: 83 Columns: 9
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (9): Timestamp, initials_extractor, study_id, paper_title, author_year, ...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Load data set containing information on the design of each study
sd <- read_csv(here("data","zf_sm_study_details.csv"), skip = 0) # 83 rows 10 columns ## New names:
## Rows: 83 Columns: 10
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (10): ...1, study_id, study_type, life_stage_exposure, life_stage_behavi...
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
## • `` -> `...9`
## • `` -> `...10`
# Load data set containing details of each pesticide used in each exposure studies
pd <- read_csv(here("data", "zf_sm_pesticide_details.csv"), skip = 0) # 83 rows 9 columns ## Rows: 83 Columns: 9
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (8): Timestamp, study_id, pesticide_target_class, pesticide_chemical_cla...
## lgl (1): pesticide_comment
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Load data set containing details of dosage and duration of pesticide exposure
pdo <-read_csv(here("data","zf_sm_pesticide_dosage.csv"), skip = 0) # 108 rows 12 columns ## Rows: 108 Columns: 12
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (12): Timestamp, study_id, pesticide_investigated, route, dosage_number,...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Load data set containing details of behaviorus measured in response to pesticide exposure
bd <- read_csv(here("data", "zf_sm_behaviour_details.csv"), skip = 0) # 83 rows 13 columns ## Rows: 83 Columns: 13
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (11): Timestamp, study_id, behavioural_class, behaviour_social, behaviou...
## lgl (2): behaviour_courtship, behaviour_parental_care
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Load bibliometric information extracted from scopus
bib_sco <- convert2df(here("data","scopus.bib"), dbsource = "scopus", format = "bibtex") # 79 rows 38 columns ##
## Converting your scopus collection into a bibliographic dataframe
##
## Done!
##
##
## Generating affiliation field tag AU_UN from C1: Done!
Objective 0: General literature characteristics
fig 2- study time time trends
# Count the number of articles by year
fig2 <- bib %>%
count(publication_year) %>%
# Create a bar chart with publication year on x-axis and count on y-axis
ggplot(aes(x = publication_year, y = n)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8, position = position_dodge(0.9)) +
# Add labels to the bars
geom_text(aes(label = n), position = position_stack(vjust = 0.5), fontface = "bold", color = "white", size = 5, hjust = 0.5) +
# Customize the appearance of the plot
theme_minimal() +
labs(x = "Year", y = "Article Count") +
theme(legend.position = "none",
axis.title.x = element_text(size = 15, face = "bold"),
axis.title.y = element_text(size = 15, face = "bold"),
axis.text.x = element_text(angle = 45, hjust = 1, size = 15),
axis.text.y = element_text(size = 15),
panel.grid.major.y = element_line(color = "gray"),
panel.grid.minor.y = element_blank(),
plot.title = element_text(size = 16, face = "bold"))
fig2# ggsave(here("figures", "fig2_time_trends.pdf"), width = 16, height = 10, units = "cm", scale = 2, dpi = 300, device = cairo_pdf)Objective 1. To investigate the types of pesticides and pesticide classes, both in terms of chemical and target, that have been used in experiments examining the effects of pesticide exposure on zebrafish behaviour.
fig3a - plot for total of individual pesticides used in pesticide exposure studies
# Separate rows with multiple pesticides, count their occurrence, and combined all pesticide that occured once as "other"
total_pesticide_count <- pd %>%
separate_rows(pesticide_investigated, sep = ", ") %>%
count(pesticide_investigated) %>%
mutate(pesticide_investigated = ifelse(n == 1, "other", as.character(pesticide_investigated))) %>%
# "other" includes tribotyltin, terbutylazine, sodium fluride, pyrimethonil, pyraclostrobin, propiconazole, prochloraz, parathion, paclobutazol, monocotophos, methylbenzoate, methylbenzoate, methomyl, mecroprop, linuron, endosulfan, diuron, difenoconazole, dicamba, cyprodinil, chlorothalonil, carbofuran, carbaryl, broflanilide and boscalid.
group_by(pesticide_investigated) %>%
summarise(n = sum(n))
# Calculate pesticide count as a percentage
pesticide_pct <- total_pesticide_count %>%
mutate(proportion = n/sum(total_pesticide_count$n),
percentage = proportion*100)
# Create a bar chart with the count of pesticides on the x-axis and pesticides on the y-axis
fig3a <- ggplot(pesticide_pct, aes(x = reorder(pesticide_investigated, n), y = percentage)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8, position = position_dodge(0.9)) +
# Add labels to the bars for absolute count
geom_text(aes(label = n), position = position_stack(vjust = 0.5), color = "white", fontface = "bold", size = 5) +
# Add labels to the bars for percentage
geom_text(data = pesticide_pct, aes(label = paste0(round(percentage,1), "%")),
position = position_dodge(width = 0.9), hjust = -0.2, size = 5, color = "black", fontface = "bold") +
# Customize the appearance of the plot
labs(x = "Pesticide", y = "Percentage") +
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15),
axis.title = element_text(size = 15),
plot.title = element_blank()) +
coord_flip() +
ylim(0,30)
fig3a# ggsave(here("figures", "fig3a_pesticide_count.pdf"), width = 16, height = 10, units = "cm", scale = 2, dpi = 300, device = cairo_pdf)fig3b - total for each pesticide target class used in pesticide exposure studies
# Separate rows with multiple pesticides and count their occurrence
total_target_class_count <- pd %>%
separate_rows(pesticide_target_class, sep = ",\\s*") %>%
count(pesticide_target_class)
# Calculate target class count as a percentage
target_class_pct <- total_target_class_count %>%
mutate(proportion = n/sum(total_target_class_count$n),
percentage = proportion*100)
# Create a bar chart with the count of target classes on the x-axis and pesticides target class on the y-axis
fig3b <- ggplot(target_class_pct, aes(reorder(pesticide_target_class, n), y = percentage)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8, position = position_dodge(0.9)) +
# Add labels to the bars for absolute count
geom_text(aes(label = n), position = position_stack(vjust = 0.5), color = "white", fontface = "bold", size = 7) +
# Add labels to the bars for percentage
geom_text(data = target_class_pct, aes(label = paste0(round(percentage, 1), "%")),
position = position_dodge(width = 0.9), hjust = -0.2, size = 7, color = "black", fontface = "bold") +
# Customize the appearance of the plot
labs(x = "Pesticide Target Class", y = "Percentage") +
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 20),
axis.text.y = element_text(size = 20),
axis.title.x = element_text(size = 20),
axis.title.y = element_text(size = 20),
plot.title = element_blank()) +
coord_flip() +
ylim(0, 80)
fig3b# ggsave(here("figures", "fig3b_pesticide_target_count.pdf"), width = 16, height = 10, units = "cm", scale = 2, dpi = 300, device = cairo_pdf)fig3c - total for chemical class
# Separate rows with multiple pesticides and count their occurrence, then filter for cases with more than one occurrence
total_chemical_class_count <- pd %>%
separate_rows(pesticide_chemical_class, sep = ",\\s*") %>%
count(pesticide_chemical_class) %>%
mutate(pesticide_chemical_class = ifelse(n == 1, "other", as.character(pesticide_chemical_class))) %>%
# "other" includes tribotyltin, terbutylazine, sodium fluride, pyrimethonil, pyraclostrobin, propiconazole, prochloraz, parathion, paclobutazol, monocotophos, methylbenzoate, methylbenzoate, methomyl, mecroprop, linuron, endosulfan, diuron, difenoconazole, dicamba, cyprodinil, chlorothalonil, carbofuran, carbaryl, broflanilide and boscalid.
group_by(pesticide_chemical_class) %>%
summarise(n = sum(n))
# Calculate target class count as a percentage
chemical_class_pct <- total_chemical_class_count %>%
mutate(proportion = n/sum(total_chemical_class_count$n),
percentage = proportion*100)
# Create a bar chart with the count of chemical classes on the x-axis and pesticides chemical class on the y-axis
fig3c <- ggplot(chemical_class_pct, aes(x = reorder(pesticide_chemical_class,n), y = percentage)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8, position = position_dodge(0.9)) +
# Add labels to the bars
geom_text(aes(label = n), position = position_stack(vjust = 0.5), color = "white", fontface = "bold", size = 5) +
# Add labels to the bars for percentage
geom_text(data = chemical_class_pct, aes(label = paste0(round(percentage,1), "%")),
position = position_dodge(width = 0.9), hjust = -0.2, size = 5, color = "black", fontface = "bold") +
# Customize the appearance of the plot
labs(x = "Pesticide Chemical Class", y = "Percentage") +
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 20),
axis.text.y = element_text(size = 15),
axis.title.x = element_text(size = 20),
axis.title.y = element_text(size = 20),
plot.title = element_blank()) +
coord_flip() +
ylim(0, 40)
fig3c# ggsave(here("figures", "fig3c_pesticide_chemical_count.pdf"), width = 16, height = 10, units = "cm", scale = 2, dpi = 300, device = cairo_pdf)##fig3 combined
# Combine three plots into a single plot using a grid layout
fig3 <- ((fig3a) | (fig3b / fig3c) + plot_annotation(tag_levels = "A"))
fig3#ggsave(here("figures", "fig3_pesticide_count_combined.pdf"), width = 16, height = 10, units = "cm", scale = 2, dpi = 300, device = cairo_pdf)Objective 2. To investigate pesticide exposure study designs such as concentration and duration of exposure, life stages of zebrafish used in each study and the sample sizes used.
figs3 - total route of exposure
# Count the total occurrence of each route in the data set
total_route_count <- pdo %>%
count(route)
# Count the proportion and percentage of each route in the data set
route_pct <- pdo %>%
count(route) %>%
mutate(proportion = n/sum(total_route_count$n),
percentage = proportion*100)
# Create a bar chart with the percentage of pesticides by route of exposure on the x-axis and the routes of exposure on the y-axis
figs3 <- ggplot(route_pct, aes(x = reorder(route, percentage), y = percentage)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8, position = position_dodge(0.9)) +
# Add absolute count to bars
geom_text(aes(label = n), position = position_stack(vjust = 0.5), color = "white", fontface = "bold", size = 5) +
# Add percentage label to bars
geom_text(aes(label = paste0(round(percentage, 1), "%")), hjust = -0.2, vjust = 0.5, size = 5, fontface = "bold") +
# Customize the appearance of the plot
labs(x = "Route of Exposure", y = "Percentage") +
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank()) +
coord_flip() +
ylim(0, 100)
figs3# ggsave(here("figures", "figs3_pesticide_chemical_count.pdf"), width = 16, height = 10, units = "cm", scale = 2, dpi = 300, device = cairo_pdf)Objective 2. To investigate the study designs employed to assess the effects of pesticide exposure on the behaviour of non-larval zebrafish.
making dosages consistent for dosage comparisons
pdo <- pdo %>%
# Remove rows with NA values
filter(!is.na(dosage_lowest)) %>%
# Convert dosage_lowest to numeric and dosage_lowest_unit to character
mutate(dosage_lowest = as.numeric(dosage_lowest),
dosage_lowest_unit = as.character(dosage_lowest_unit),
# Standardize dosage_unit_consistent based on dosage_lowest_unit
dosage_unit_consistent = case_when(
dosage_lowest_unit == "mg/L" ~ "ug/L",
dosage_lowest_unit == "ng/L" ~ "ug/L",
dosage_lowest_unit == "g/L" ~ "ug/L",
dosage_lowest_unit == "ppb" ~ "ug/L",
dosage_lowest_unit == "ppm" ~ "ug/L",
TRUE ~ dosage_lowest_unit),
# Convert dosage_lowest to ug/L based on dosage_lowest_unit
dosage_lowest_convert_ugL = case_when(
dosage_lowest_unit == "mg/L" ~ dosage_lowest * 1000,
dosage_lowest_unit == "ng/L" ~ dosage_lowest / 1000,
dosage_lowest_unit == "g/L" ~ dosage_lowest/1000000,
dosage_lowest_unit == "ppb" ~ dosage_lowest * 1000,
dosage_lowest_unit == "ppm" ~ dosage_lowest/1000,
TRUE ~ dosage_lowest),
# Convert dosage_highest to numeric and dosage_highest_unit to character
dosage_highest = as.numeric(dosage_highest),
# Convert dosage_highest to ug/L based on dosage_highest_unit
dosage_highest_convert_ugL = case_when(
dosage_highest_unit == "mg/L" ~ dosage_highest * 1000,
dosage_highest_unit == "ng/L" ~ dosage_highest / 1000,
dosage_highest_unit == "g/L" ~ dosage_highest/1000000,
dosage_highest_unit == "ppb" ~ dosage_highest * 1000,
dosage_highest_unit == "ppm" ~ dosage_highest/1000,
TRUE ~ dosage_highest))## Warning: There were 2 warnings in `mutate()`.
## The first warning was:
## ℹ In argument: `dosage_lowest = as.numeric(dosage_lowest)`.
## Caused by warning:
## ! NAs introduced by coercion
## ℹ Run ]8;;ide:run:dplyr::last_dplyr_warnings()dplyr::last_dplyr_warnings()]8;; to see the 1 remaining warning.
fig4 - comparison of lowest and highest dosages in waterbourne exposure methods
# Pivot the dataset to a longer format, separating out the dosage type (lowest or highest) and value into separate columns
pdo_waterbourne <- pdo %>%
pivot_longer(cols = c(dosage_lowest, dosage_highest),
names_to = "dosage_type",
values_to = "dosage_value") %>%
# Filter for waterborne routes with consistent dosage units and a dosage number greater than 1
filter(route == "waterbourne", dosage_unit_consistent == "ug/L",
dosage_number > 1) %>%
# Rename the dosage type column for better labeling in the plot
mutate(dosage_type = if_else(dosage_type == "dosage_lowest", "Lowest Dosage Exposed", "Highest Dosage Exposed"))
# Create the plot with dosage type (i.e., lowest or highest dose) on the x-axis and dosage value on the y-axis
fig4 <- ggplot(pdo_waterbourne, aes(x = dosage_type, y = log(dosage_value))) +
# Add a violin plot
geom_violin(fill = "#5F85AE", alpha =0.2, color = NA, trim = FALSE) +
# Add a boxplot
geom_boxplot(width = 0.05, fill = "white", color = "#5F85AE", outlier.shape = NA) +
# Add jittered points .
geom_jitter(width = 0.1, height = 0.05, color = "#5F85AE", alpha = 0.8) +
# Add axis and plot labels
labs(title = "Waterborne Exposures by Dosage in ug/L", x = "Waterborne Exposure", y = "log(Dosage (ug/L))") +
# Customize plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank())
fig4ggsave(here("figures", "fig4_pesticide_dosage.pdf"), width = 16, height = 10, units = "cm", scale = 2, dpi = 300, device = cairo_pdf)figs4 - comparison of lowest and highest dosages of waterbourne exposure to deltamethrin
# Pivot the data set to a longer format, separating out the dosage type (lowest or highest) and value into separate columns
pdo_waterbourne_deltamethrin <- pdo %>%
pivot_longer(cols = c(dosage_lowest, dosage_highest),
names_to = "dosage_type",
values_to = "dosage_value") %>%
# Filter for waterborne routes with consistent dosage units and only deltamethrin pesticide investigated
filter(route == "waterbourne", dosage_unit_consistent == "ug/L", pesticide_investigated == "deltamethrin") %>%
# Rename the dosage type column for better labeling in the plot
mutate(dosage_type = if_else(dosage_type == "dosage_lowest", "Lowest Dosage Exposed", "Highest Dosage Exposed"))
# Create the plot with dosage type (i.e., lowest or highest dose) on the x-axis and dosage value on the y-axis
figs4 <- ggplot(pdo_waterbourne_deltamethrin, aes(x = dosage_type, y = log(dosage_value))) +
# Add a violin plot
geom_violin(fill = "#5F85AE", alpha = 0.2, color = NA, trim = FALSE) +
# Add a boxplot
geom_boxplot(width = 0.05, fill = "white", color = "#5F85AE", outlier.shape = NA) +
# Add jittered points
geom_jitter(width = 0.1, height = 0.05, color = "#5F85AE", alpha = 0.5) +
# Add axis and plot labels
labs(title = "Waterborne Exposures of Deltamethrin by Dosage in ug/L", x = "Waterbourne exposure", y = "log(Dosage (ug/L))") +
# Customize plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank())
# figs4figs5 - comparison of lowest and highest dosages of waterbourne exposure to rotenone
# Pivot the data set to a longer format, separating out the dosage type (lowest or highest) and value into separate columns
pdo_waterbourne_rotenone <- pdo %>%
pivot_longer(cols = c(dosage_lowest, dosage_highest),
names_to = "dosage_type",
values_to = "dosage_value") %>%
# Filter for waterborne routes with consistent dosage units and only rotenone pesticide investigated
filter(route == "waterbourne", dosage_unit_consistent == "ug/L", pesticide_investigated == "rotenone") %>%
# Rename the dosage type column for better labeling in the plot
mutate(dosage_type = if_else(dosage_type == "dosage_lowest", "Lowest Dosage Exposed", "Highest Dosage Exposed"))
# Create the plot with dosage type (i.e., lowest or highest dose) on the x-axis and dosage value on the y-axis
figs5 <- ggplot(pdo_waterbourne_rotenone, aes(x = dosage_type, y = log(dosage_value))) +
# Add a violin plot
geom_violin(fill = "#5F85AE", alpha = 0.3, trim = FALSE, color = NA) +
# Add a boxplot
geom_boxplot(width = 0.05, fill = "white", color = "#5F85AE", outlier.shape = NA) +
# Add jittered points
geom_jitter(width = 0.1, height = 0.05, color = "#5F85AE", alpha = 0.5) +
# Add axis and plot labels
labs(title = "Waterborne Exposures of Rotenone by Dosage in ug/L", x = "Waterbourne exposure", y = "log(Dosage (ug/L))") +
# Customize plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank())
figs5figs6 - comparison of lowest and highest dosages of waterbourne exposure atrazine
# Pivot the data set to a longer format, separating out the dosage type (lowest or highest) and value into separate columns
pdo_waterbourne_atrazine <- pdo %>%
pivot_longer(cols = c(dosage_lowest, dosage_highest),
names_to = "dosage_type",
values_to = "dosage_value") %>%
# Filter for waterborne routes with consistent dosage units and only atrazine pesticide investigated
filter(route == "waterbourne", dosage_unit_consistent == "ug/L", pesticide_investigated == "atrazine") %>%
# Rename the dosage type column for better labeling in the plot
mutate(dosage_type = if_else(dosage_type == "dosage_lowest", "Lowest Dosage Exposed", "Highest Dosage Exposed"))
# Create the plot with dosage type (i.e., lowest or highest dose) on the x-axis and dosage value on the y-axis
figs6 <- ggplot(pdo_waterbourne_atrazine, aes(x = dosage_type, y = log(dosage_value))) +
# Add a violin plot
geom_violin(fill = "#5F85AE", alpha = 0.3, trim = FALSE, color = "NA") +
# Add a boxplot
geom_boxplot(width = 0.05, fill = "white", color = "#5F85AE", outlier.shape = NA) +
# Add jittered points
geom_jitter(width = 0.1, height = 0.05, color = "#5F85AE", alpha = 0.5) +
# Add axis and plot labels
labs(title = "Waterborne Exposures of Atrazine by Dosage in ug/L", x = "Waterborne exposure", y = "log(Dosage (ug/L))") +
# Customize plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank())
figs6figs7 - comparison to lowest and highest dosages of waterbourne exposure to glyphosate
# Pivot the data set to a longer format, separating out the dosage type (lowest or highest) and value into separate columns
pdo_waterbourne_glyphosate <- pdo %>%
pivot_longer(cols = c(dosage_lowest, dosage_highest),
names_to = "dosage_type",
values_to = "dosage_value") %>%
# Filter for waterborne routes with consistent dosage units and only glyphosate pesticide investigated
filter(route == "waterbourne", dosage_unit_consistent == "ug/L", pesticide_investigated == "glyphosate") %>%
# Rename the dosage type column for better labeling in the plot
mutate(dosage_type = if_else(dosage_type == "dosage_lowest", "Lowest Dosage Exposed", "Highest Dosage Exposed"))
# Create the plot with dosage type (i.e., lowest or highest dose) on the x-axis and dosage value on the y-axis
figs7 <- ggplot(pdo_waterbourne_glyphosate, aes(x = dosage_type, y = log(dosage_value))) +
# Add a violin plot
geom_violin(fill = "#5F85AE", alpha = 0.3, trim = FALSE, color = NA) +
# Add a boxplot
geom_boxplot(width = 0.05, fill = "white", color = "#5F85AE", outlier.shape = NA) +
# Add jittered points
geom_jitter(width = 0.1, height = 0.05, color = "#5F85AE", alpha = 0.5) +
# Add axis and plot labels
labs(title = "Waterborne Exposures of Glyphosate by Dosage in ug/L", x = "Waterbourne exposure", y = "log(Dosage (ug/L))") +
# Customize plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank())
figs7figs8 - comparison to lowest and highest dosages of waterbourne exposure to chlopyrifo
# Pivot the data set to a longer format, separating out the dosage type (lowest or highest) and value into separate columns
pdo_waterbourne_chloropyrifo <- pdo %>%
pivot_longer(cols = c(dosage_lowest, dosage_highest),
names_to = "dosage_type",
values_to = "dosage_value") %>%
# Filter for waterborne routes with consistent dosage units and only glyphosate pesticide investigated
filter(route == "waterbourne", dosage_unit_consistent == "ug/L", pesticide_investigated == "chloropyrifo") %>%
# Rename the dosage type column for better labeling in the plot
mutate(dosage_type = if_else(dosage_type == "dosage_lowest", "Lowest Dosage Exposed", "Highest Dosage Exposed"))
# Create the plot with dosage type (i.e., lowest or highest dose) on the x-axis and dosage value on the y-axis
figs8 <- ggplot(pdo_waterbourne_chloropyrifo, aes(x = dosage_type, y = log(dosage_value))) +
# Add a violin plot
geom_violin(fill = "#5F85AE", alpha = 0.3, trim = FALSE, color = NA) +
# Add a boxplot
geom_boxplot(width = 0.05, fill = "white", color = "#5F85AE", outlier.shape = NA) +
# Add jittered points
geom_jitter(width = 0.1, height = 0.05, color = "#5F85AE", alpha = 0.5) +
# Add axis and plot labels
labs(title = "Waterborne Exposures of Chloropyrifos by Dosage in ug/L", x = "Waterbourne exposure", y = "log(Dosage (ug/L))") +
# Customize plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank())
figs8figx - durations of waterbourne exposure
pdo <- pdo %>%
filter(!is.na(duration)) %>%
# Convert duration to numeric and duration_unit to character
mutate(duration = as.numeric(duration),
duration_unit = as.character(duration_unit),
# Standardize duration_unit_consistent based on dosage_unit
duration_unit_consistent = case_when(
duration_unit == "minutes" ~ "hours",
duration_unit == "days" ~ "hours",
duration_unit == "weeks" ~ "hours",
TRUE ~ duration_unit),
# Convert duration to hours based on duration_unit
duration_convert = case_when(
duration_unit == "minutes" ~ duration* 60,
duration_unit == "days" ~ duration/24,
duration_unit == "weeks" ~ duration/168,
TRUE ~ duration)) %>%
filter(route == "waterbourne")## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `duration = as.numeric(duration)`.
## Caused by warning:
## ! NAs introduced by coercion
figx <- ggplot(pdo, aes(x = route , y = log(duration))) +
# Add a violin plot
geom_violin(fill = "#5F85AE", alpha =0.2, color = NA, trim = FALSE) +
# Add a boxplot
geom_boxplot(width = 0.05, fill = "white", color = "#5F85AE", outlier.shape = NA) +
# Add jittered points
geom_jitter(width = 0.1, height = 0.05, color = "#5F85AE", alpha = 0.8) +
# Add axis and plot labels
labs(x = "Route ", y = "log(duration (hours))") +
# Customize plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank())
figx## Warning: Removed 7 rows containing non-finite values (`stat_ydensity()`).
## Warning: Removed 7 rows containing non-finite values (`stat_boxplot()`).
## Warning: Removed 7 rows containing missing values (`geom_point()`).
figs9 - total lifestage of exposure completed as a percentage
# Calculate total count for each category
total_count_lse <- sd %>% count(life_stage_exposure)
# Calculate proportion and percentage for each category
life_stage_pct <- sd %>%
separate_rows(life_stage_exposure, sep = ",\\s*") %>%
count(life_stage_exposure) %>%
mutate(proportion = n/sum(total_count_lse$n),
percentage = proportion*100)
# Create a bar chart with the count on the x-axis and life stage of exposure on the y-axis
figs9 <- ggplot(life_stage_pct, aes(x = reorder(life_stage_exposure, percentage), y = percentage)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8, position = position_dodge(0.9)) +
# Add labels to the bars for percentage
geom_text(aes(label = paste0(round(percentage, 1), "%")), hjust = -0.2, vjust = 0.5, size = 5, fontface = "bold") +
# Add absolute count to bars
geom_text(aes(label = n), position = position_stack(vjust = 0.5), color = "white", fontface = "bold", size = 5) +
# Add axis and plot labels
labs( x = "Life Stage of Exposure", y = "Percentage", fontsize = 14) +
# Customize the plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank()) +
coord_flip() +
ylim(0, 100)
figs9figs10 - total lifestage of behaviour completed as a percentage
# Calculate total count for each category
total_count_lsb <- sd %>% count(life_stage_behaviour)
# Calculate proportion and percentage for each category
life_stage_pct <- sd %>%
separate_rows(life_stage_behaviour, sep = ",\\s*") %>%
count(life_stage_behaviour) %>%
mutate( proportion = n / sum(total_count_lsb$n),
percentage = proportion * 100)
# Create a bar chart with the count on the x-axis and life stage of behavior on the y-axis
figs10 <- ggplot(life_stage_pct, aes(x = reorder(life_stage_behaviour, percentage), y = percentage)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8,position = position_dodge(0.9)) +
# Add labels to the bars for percentage
geom_text(aes(label = paste0(round(percentage, 1), "%")), hjust = -0.2, vjust = 0.5, size = 5, fontface = "bold") +
# Add absolute count to bars
geom_text(aes(label = n), position = position_stack(vjust = 0.5), color = "white",fontface = "bold", size = 5) +
# Add axis and plot labels
labs(x = "Life Stage of Behavior", y = "Percentage", fontsize = 14) +
# Customize the plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank()) +
coord_flip() +
ylim(0, 100)
figs10figs11 - total sexes exposed completed as a percentage
# Calculate total count for each category
total_sex_count <- sd %>% count(sex)
# Calculate proportion and percentage for each category
sex_pct <- sd %>%
count(sex) %>%
mutate(proportion = n/sum(total_sex_count$n),
percentage = proportion*100)
# Create a bar chart with the count on the x-axis and behaviorual class on the y-axis
figs11 <- ggplot(sex_pct, aes(x = reorder(sex, percentage), y = percentage)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8, position = position_dodge(0.9)) +
# Add labels to the bars for percentage
geom_text(aes(label = paste0(round(percentage, 1), "%")), hjust = -0.2, vjust = 0.5, size = 5, fontface = "bold") +
# Add absolute count to bars
geom_text(aes(label = n), position = position_stack(vjust = 0.5), color = "white", fontface = "bold", size = 5) +
# Add axis and plot labels
labs(x = "Sex of Exposure", y = "Percentage") +
# Customize the plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank()) +
coord_flip() +
ylim(0, 100)
figs11Objective 3. To identify the specific behaviours that have been investigated in pesticide exposure experiments that use zebrafish as a model.
fig5 - total number of studies investigating each broad behaviour class
# Calculate total count for each category
total_behaviour_class_count <- bd %>%
separate_rows(behavioural_class, sep = ",\\s*") %>%
count(behavioural_class)
# Calculate proportion and percentage for each category
behav_class_pct <- total_behaviour_class_count %>%
mutate(proportion = n/sum(total_behaviour_class_count$n),
percentage = proportion*100)
# Create a bar chart with the count on the x-axis and Behavioural class assay on the y-axis
fig5 <- ggplot(behav_class_pct, aes(x = reorder(behavioural_class, percentage), y = percentage)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8, position = position_dodge(0.9)) +
# Add labels to the bars for percentage
geom_text(aes(label = paste0(round(percentage, 1), "%")), hjust = -0.2, vjust = 0.5, size = 5, fontface = "bold", color = "black") +
# Add labels to the bars for absolute count
geom_text(aes(label = n), position = position_stack(vjust = 0.5), color = "white", size = 5, hjust = 0.5, fontface = "bold") +
# Add axis and plot labels
labs(x = "Behavioural Class", y = "Percentage") +
# Customize the plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank()) +
coord_flip() +
ylim(0, 50)
fig5figs12 - total number of studies investigating each behavioural assay of behaviour activity
# Calculate count for each assay in behavioral activity
total_behaviour_activity_count <- bd %>%
separate_rows(behaviour_activity, sep = ",\\s*") %>%
count(behaviour_activity) %>%
na.omit()
# Calculate proportion and percentage for each category
behav_activity_pct <- total_behaviour_activity_count %>%
mutate(proportion = n/sum(total_behaviour_activity_count$n),
percentage = proportion*100)
# Create a bar chart with the count on the x-axis and Behavioural activity assay on the y-axis
figs12 <- ggplot(behav_activity_pct, aes(x = reorder(behaviour_activity, n), y = percentage)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8, position = position_dodge(0.9)) +
# Add labels to the bars for percentage
geom_text(aes(label = paste0(round(percentage, 1), "%")), hjust = -0.2, vjust = 0.5, size = 5, fontface = "bold", color = "black") +
# Add labels to the bars for absolute count
geom_text(aes(label = n), position = position_stack(vjust = 0.5), color = "white", size = 5, hjust = 0.5, fontface = "bold") +
# Add axis and plot labels
labs(x = "Activity Assay", y = "Percentage") +
# Customize the plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank()) +
coord_flip() +
ylim(0, 100)
figs12figs13 - total number of studies investigating each behavioural assay of behaviour_aggression
# Calculate count for each assay in aggression behavior
total_behaviour_aggression_count <- bd %>%
separate_rows(behaviour_aggression, sep = ",\\s*") %>%
count(behaviour_aggression) %>%
na.omit()
# Calculate proportion and percentage for each category
behav_aggression_pct <- total_behaviour_aggression_count %>%
mutate(proportion = n/sum(total_behaviour_aggression_count$n),
percentage = proportion*100)
# Create a bar chart with the count on the x-axis and aggression behavior assay on the y-axis
figs13 <- ggplot(behav_aggression_pct, aes(x = reorder(behaviour_aggression, n), y = percentage)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8, position = position_dodge(0.9)) +
# Add labels to the bars for percentage
geom_text(aes(label = paste0(round(percentage, 1), "%")), hjust = -0.2, vjust = 0.5, size = 5, fontface = "bold", color = "black") +
# Add labels to the bars for absolute count
geom_text(aes(label = n), position = position_stack(vjust = 0.5), color = "white", size = 5, hjust = 0.5, fontface = "bold") +
# Add axis and plot labels
labs(x = "Aggression Behavior Assay", y = "Percentage") +
# Customize the plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank()) +
coord_flip() +
ylim(0, 120)
figs13figs15 - total number of studies investigating each behavioural assay of behavioural_foraging
# Calculate count for each assay in foraging behavior
total_behaviour_foraging_count <- bd %>%
separate_rows(behaviour_foraging, sep = ",\\s*") %>%
count(behaviour_foraging) %>%
na.omit()
# Calculate proportion and percentage for each category
behav_foraging_pct <- total_behaviour_foraging_count %>%
mutate(proportion = n/sum(total_behaviour_foraging_count$n),
percentage = proportion*100)
# Create a bar chart with the count on the x-axis and foraging behavior assay on the y-axis
figs15 <- ggplot(behav_foraging_pct, aes(x = reorder(behaviour_foraging, n), y = percentage)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8, position = position_dodge(0.9)) +
# Add labels to the bars for percentage
geom_text(aes(label = paste0(round(percentage, 1), "%")), hjust = -0.2, vjust = 0.5, size = 5, fontface = "bold", color = "black") +
# Add labels to the bars for absolute count
geom_text(aes(label = n), position = position_stack(vjust = 0.5), color = "white", size = 5, hjust = 0.5, fontface = "bold") +
# Add axis and plot labels
labs(x = "Foraging Behavior Assay", y = "Percentage") +
# Customize the plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank()) +
coord_flip() +
ylim(0, 100)
figs15figs16 - total number of studies investigating each behavioural assay of anti-predator behaviour
# Calculate count for each assay in antipredator behavior
total_behaviour_antipredator_count <- bd %>%
separate_rows(behaviour_antipredator, sep = ",\\s*") %>%
count(behaviour_antipredator) %>%
na.omit()
# Calculate proportion and percentage for each category
behav_antipredator_pct <- total_behaviour_antipredator_count %>%
mutate(proportion = n/sum(total_behaviour_antipredator_count$n),
percentage = proportion*100)
# Create a bar chart with the count on the x-axis and antipredator behavior assay on the y-axis
figs16 <- ggplot(behav_antipredator_pct, aes(x = reorder(behaviour_antipredator, n), y = percentage)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8, position = position_dodge(0.9)) +
# Add labels to the bars for percentage
geom_text(aes(label = paste0(round(percentage, 1), "%")), hjust = -0.2, vjust = 0.5, size = 5, fontface = "bold", color = "black") +
# Add labels to the bars for absolute count
geom_text(aes(label = n), position = position_stack(vjust = 0.5), color = "white", size = 5, hjust = 0.5, fontface = "bold") +
# Add axis and plot labels
labs(x = "Antipredator Behavior Assay", y = "Percentage") +
# Customize the plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank()) +
coord_flip() +
ylim(0, 100)
figs16figs17 - total number of studies investigating each behavioural assay of Anxiety or Boldness behaviour
# Calculate count for each assay in anxiety behavior
total_behaviour_anxiety_count <- bd %>%
separate_rows(behaviour_anxiety, sep = ",\\s*") %>%
count(behaviour_anxiety) %>%
na.omit()
# Calculate proportion and percentage for each category
behav_anxiety_pct <- total_behaviour_anxiety_count %>%
mutate(proportion = n/sum(total_behaviour_anxiety_count$n),
percentage = proportion*100)
# Create a bar chart with the count on the x-axis and anxiety behavior assay on the y-axis
figs17 <- ggplot(behav_anxiety_pct, aes(x = reorder(behaviour_anxiety, n), y = percentage)) +
# Customize the appearance of the bars
geom_bar(stat = "identity", fill = "#5F85AE", color = "white", alpha = 0.8, position = position_dodge(0.9)) +
# Add labels to the bars for percentage
geom_text(aes(label = paste0(round(percentage, 1), "%")), hjust = -0.2, vjust = 0.5, size = 5, fontface = "bold", color = "black") +
# Add labels to the bars for absolute count
geom_text(aes(label = n), position = position_stack(vjust = 0.5), color = "white", size = 5, hjust = 0.5, fontface = "bold") +
# Add axis and plot labels
labs(x = "Anxiety Behavior Assay", y = "Percentage") +
# Customize the plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank()) +
coord_flip() +
ylim(0, 80)
figs17figs18 - heat map to show which behavours have been investigated in which pesticide target class
# Join the behaviour details and pesticide details by "study_id"
bd_pd <- left_join(bd, pd, by = "study_id")
# Separate rows in "bd_pd" by "behavioural_class" and "pesticide_target_class" columns
bd_pd1 <- separate_rows(bd_pd, behavioural_class, sep = ",\\s*", convert = TRUE)
bd_pd1<- separate_rows(bd_pd1, pesticide_target_class, sep = ",\\s*", convert = TRUE)
# Group by "behavioural_class" and "pesticide_target_class" and summarize count
bd_pd_summary1 <- bd_pd1 %>%
mutate(behavioural_class = str_trim(behavioural_class),
pesticide_target_class = str_trim(pesticide_target_class)) %>%
group_by(behavioural_class, pesticide_target_class) %>%
summarise(count = n()) %>%
ungroup() ## `summarise()` has grouped output by 'behavioural_class'. You can override using
## the `.groups` argument.
# Create a heatmap with pesticide target class on the x-axis and behavioural class on the y-axis
figs18 <- ggplot(bd_pd_summary1, aes(x = pesticide_target_class, y = behavioural_class, fill = count)) +
#Create and fill each tile
geom_tile(color = "white") +
scale_fill_gradient(low = "#F0F4F8", high = "#446487") +
# Add labels to the bars for absolute count
geom_text(aes(label = count), color = "black", size = 4) +
# Add axis and plot labels
labs(x = "Pesticide Target Class", y = "Behavioural Class", fill = "Count") +
# Customize the plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank())
figs18figs19 - heat map to show which behavours have been investigated in which pesticide chemical class
# Separate rows by behavioural_class and pesticide_chemical_class columns
bd_pd2 <- separate_rows(bd_pd, behavioural_class, sep = ",\\s*", convert = TRUE)
bd_pd2 <- separate_rows(bd_pd2, pesticide_chemical_class, sep = ",", convert = TRUE)
# Get the top 3 most numerous pesticide chemical classes
bd_pd_summary2 <- bd_pd2 %>%
mutate(behavioural_class = str_trim(behavioural_class),
pesticide_target_class = str_trim(pesticide_chemical_class)) %>%
group_by(behavioural_class, pesticide_chemical_class) %>%
summarise(count = n()) %>%
ungroup() ## `summarise()` has grouped output by 'behavioural_class'. You can override using
## the `.groups` argument.
top_pesticide_classes <- bd_pd_summary2 %>%
filter(!is.na(pesticide_chemical_class)) %>%
group_by(pesticide_chemical_class) %>%
summarise(count = sum(count)) %>%
ungroup() %>%
top_n(3, count) %>%
pull(pesticide_chemical_class)
# Subset the data to include only the top 3 classes
bd_pd_summary_top3 <- bd_pd_summary2 %>%
filter(pesticide_chemical_class %in% top_pesticide_classes)
# Create a heatmap with pesticide chemical class on the x-axis and behavioral class on the y-axis
figs19 <- ggplot(bd_pd_summary_top3, aes(x = pesticide_chemical_class, y = behavioural_class, fill = count)) +
#Create and fill each tile
geom_tile(color = "white") +
scale_fill_gradient(low = "#F0F4F8", high = "#446487") +
# Add labels to the bars for absolute count
geom_text(aes(label = ifelse(count > 0, count, "")), color = "black", size = 4) +
# Add axis and plot labels
labs(x = "Pesticide Chemical Class", y = "Behavioural Class", fill = "Count") +
# Customize the plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank())
figs19figs20 - heat map to show which life stages of exposure have been exposed to each pesticide chemical class
# Join the stydt details with pesticide details by "study_id".
sd_pd <- left_join(sd, pd, by = "study_id")
# Separate rows in "sd_pd" by "life_stage_exposure" and "pesticide_chemical_class" columns
sd_pd1 <- separate_rows(sd_pd, life_stage_exposure, sep = ",", convert = TRUE)
sd_pd1 <- separate_rows(sd_pd1, pesticide_chemical_class, sep = ",", convert = TRUE)
# Group by "life_stage_exposure" and "pesticide_chemical_class" and summarize count
sd_pd_summary1 <- sd_pd1 %>%
mutate(life_stage_exposure = str_trim(life_stage_exposure),
pesticide_chemical_class = str_trim(pesticide_chemical_class)) %>%
group_by(life_stage_exposure, pesticide_chemical_class) %>%
summarise(count = n()) %>%
ungroup()## `summarise()` has grouped output by 'life_stage_exposure'. You can override
## using the `.groups` argument.
top_pesticide_classes <- sd_pd_summary1 %>%
filter(!is.na(pesticide_chemical_class)) %>%
group_by(pesticide_chemical_class) %>%
summarise(count = sum(count)) %>%
ungroup() %>%
top_n(4, count) %>%
pull(pesticide_chemical_class)
sd_pd_summary1_top5 <- sd_pd_summary1 %>%
filter(pesticide_chemical_class %in% top_pesticide_classes)
# Create a heatmap with pesticide target class on the x-axis and behavioural class on the y-axis
figs20 <- ggplot(sd_pd_summary1_top5, aes(x = pesticide_chemical_class, y = life_stage_exposure, fill = count)) +
#Create and fill each tile
geom_tile(color = "white") +
scale_fill_gradient(low = "#F0F4F8", high = "#446487") +
# Add labels to the bars for absolute count
geom_text(aes(label = ifelse(count > 0, count, "")), color = "black", size = 4) +
# Add axis and plot labels
labs(x = "Pesticide Chemical Class", y = "Life Stage Exposure", fill = "Count") +
# Customize the plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank())
figs20figs21 - heat map to show which life stages of exposure have been exposed to each target chemical class
# Separate rows by life_stage_exposure and pesticide_target_class columns
sd_pd2 <- separate_rows(sd_pd, life_stage_exposure, sep = ",", convert = TRUE)
sd_pd2 <- separate_rows(sd_pd2, pesticide_target_class, sep = ",", convert = TRUE)
# Group by "life_stage_exposure" and "pesticide_target_class" and summarize count
sd_pd_summary2 <- sd_pd2 %>%
mutate(life_stage_exposure = str_trim(life_stage_exposure),
pesticide_target_class = str_trim(pesticide_target_class)) %>%
group_by(life_stage_exposure, pesticide_target_class) %>%
summarise(count = n()) %>%
ungroup()## `summarise()` has grouped output by 'life_stage_exposure'. You can override
## using the `.groups` argument.
# Create a heatmap with pesticide target class on the x-axis and life stage exposure on the y-axis
figs21 <- ggplot(sd_pd_summary2, aes(x = pesticide_target_class, y = life_stage_exposure, fill = count)) +
#Create and fill each tile
geom_tile(color = "white") +
scale_fill_gradient(low = "#F0F4F8", high = "#446487") +
# Add labels to the bars for absolute count
geom_text(aes(label = ifelse(count > 0, count, "")), color = "black", size = 4) +
# Add axis and plot labels
labs(x = "Pesticide Target Class", y = "Life Stage Exposure", fill = "Count") +
# Customize the plot theme
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(size = 15),
axis.text.y = element_text(size = 15, hjust = 1),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 15),
plot.title = element_blank())
figs21